//
//  MovieListTableViewCell.m
//  UI-豆瓣项目APP
//
//  Created by dllo on 15/9/8.
//  Copyright (c) 2015年 孙鹏. All rights reserved.
//

#import "MovieListTableViewCell.h"
#import "AppTools.h"
#import "UIImageView+WebCache.h"

@implementation MovieListTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        [self createSubCells];
    }
    return self;
}
-(void)createSubCells{
    UIImageView *background = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bg_eventlistcell"]];
    background.frame = CGRectMake(10, 15, 355, 160);
    [self addSubview:background];
    [background release];
    
    self.poster = [[UIImageView alloc]initWithFrame:CGRectMake(25, 30, 100, 130)];
    [self addSubview:self.poster];
    [_poster release];
    
    self.movieName = [[UILabel alloc]initWithFrame:CGRectMake(130, 60, 200, 50)];
//    self.movieName.backgroundColor = [UIColor redColor];
    [self addSubview:self.movieName];
    [_movieName release];
}
-(void)setMovie:(MovieList *)movie{
    if(_movie != movie){
        [_movie release];
        _movie  = [movie retain];
    }
    self.movieName.text = self.movie.movieName;
    NSURL *url = [NSURL URLWithString:self.movie.pic_url];
    [self.poster sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placehold"]];
}
- (void)awakeFromNib {
    // Initialization code
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
